package com.healthtop.utils;



import org.apache.shiro.crypto.hash.Md5Hash;

import java.util.Random;

/**
 * * 椿熙堂信息研发部
 * Author: 道长 on 2016/10/14.
 */
public class SecurityUtils {

    static Random random = new Random();

    /**
     * md5加密算法
     * @param password
     * @param salt
     * @return
     */
    public static String md5(String password,String salt){
        return new Md5Hash(password,salt).toHex();
    }

    public static String buildSalt(int len){
        String r = "";
        for(int i = 0;i<len;i++){
            r+=random.nextInt(10);
        }
        return r;

    }

    public static void main(String[] args) {
        String result = buildSalt(6);
        System.out.println(result);
        String value = md5("1111111","341234");
        System.out.println(value);
    }

}
